--Building
--Insert
Create PROCEDURE [dbo].[Building_Insert]
@buildingID int,
@name nvarchar(50),
@description nvarchar(100),
@location nvarchar(50),
@type nvarchar(50),
@area float,
@farmID int,
@buildingTypeID int
as
insert into Building
(name,description,location,type,area,farmID,buildingTypeID)
Values
(@name,@description,@location,@type,@area,@farmID,@buildingTypeID)
go

--Update
Create PROCEDURE [dbo].[Building_Update]
@buildingID int,
@name nvarchar(50),
@description nvarchar(100),
@location nvarchar(50),
@type nvarchar(50),
@area float,
@farmID int,
@buildingTypeID int
as
Update Building Set
name= @name,description= @description,location= @location,type= @type,area= @area,farmID= @farmID,buildingTypeID= @buildingTypeID 
 Where buildingID= @buildingID
go

--Delete
Create PROCEDURE [dbo].[Building_Delete]
@buildingID int
AS
Delete FROM Building 
where buildingID = @buildingID 
go

--Select all
Create PROCEDURE [dbo].[Building_SelectAll]
AS
Select * from Building 
go

--Select by ID
Create PROCEDURE [dbo].[Building_SelectByID]
@buildingID int
AS
Select * from Building 
where buildingID = @buildingID 
go


--BuildingType
--INsert
Create PROCEDURE [dbo].[BuildingType_Insert]
@buildingTypeID int,
@buildingTypeName nvarchar(50)
as
insert into BuildingType
(buildingTypeName)
Values
(@buildingTypeName)
go
--Update
Create PROCEDURE [dbo].[BuildingType_Update]
@buildingTypeID int,
@buildingTypeName nvarchar(50)
as
Update BuildingType Set
 buildingTypeName= @buildingTypeName 
 Where buildingTypeID= @buildingTypeID
go
--delete
Create PROCEDURE [dbo].[BuildingType_Delete]
@buildingTypeID int
AS
Delete FROM BuildingType 
where buildingTypeID = @buildingTypeID 
go
--select all
Create PROCEDURE [dbo].[BuildingType_SelectAll]
AS
Select * from BuildingType 
go
--select by ID
Create PROCEDURE [dbo].[BuildingType_SelectByID]
@buildingTypeID int
AS
Select * from BuildingType 
where buildingTypeID = @buildingTypeID 
go

--BulkProduct
--insert
Create PROCEDURE [dbo].[BulkProduct_Insert]
@bulkProductID int,
@fieldID int,
@bulkProductTypeID int,
@havestSeason datetime,
@productID int,
@quanlity int,
@productName nvarchar(50)
as
insert into BulkProduct
(fieldID,bulkProductTypeID,havestSeason,productID,quanlity,productName)
Values
(@fieldID,@bulkProductTypeID,@havestSeason,@productID,@quanlity,@productName)
go
--update
Create PROCEDURE [dbo].[BulkProduct_Update]
@bulkProductID int,
@fieldID int,
@bulkProductTypeID int,
@havestSeason datetime,
@productID int,
@quanlity int,
@productName nvarchar(50)
as
Update BulkProduct Set
fieldID= @fieldID,bulkProductTypeID= @bulkProductTypeID,havestSeason= @havestSeason,productID= @productID,quanlity= @quanlity,productName= @productName 
 Where bulkProductID= @bulkProductID
go
--delete
Create PROCEDURE [dbo].[BulkProduct_Delete]
@bulkProductID int
AS
Delete FROM BulkProduct 
where bulkProductID = @bulkProductID 
go
--select all
Create PROCEDURE [dbo].[BulkProduct_SelectAll]
AS
Select * from BulkProduct 
go
--select by ID
Create PROCEDURE [dbo].[BulkProduct_SelectByID]
@bulkProductID int
AS
Select * from BulkProduct 
where bulkProductID = @bulkProductID 
go

--BulkProduct_Field
--insert
Create PROCEDURE [dbo].[BulkProduct_Field_Insert]
@fieldID int,
@bulkProductID int
as
insert into BulkProduct_Field
(fieldID,bulkProductID)
Values
(@fieldID,@bulkProductID)
go
--update
Create PROCEDURE [dbo].[BulkProduct_Field_Update]
@fieldID int,
@bulkProductID int
as
Update BulkProduct_Field Set
 fieldID= @fieldID,bulkProductID= @bulkProductID 
 Where fieldID= @fieldID
go
--delete
Create PROCEDURE [dbo].[BulkProduct_Field_Delete]
@fieldID int
AS
Delete FROM BulkProduct_Field 
where fieldID = @fieldID 
go
--select all
Create PROCEDURE [dbo].[BulkProduct_Field_SelectAll]
AS
Select * from BulkProduct_Field 
go
--select by ID
Create PROCEDURE [dbo].[BulkProduct_Field_SelectByID]
@fieldID int
AS
Select * from BulkProduct_Field 
where fieldID = @fieldID 
go

--BulkProductType
--insert
Create PROCEDURE [dbo].[BulkProductType_Insert]
@bulkProductTypeID int,
@bulkProductTypeName nvarchar(50)
as
insert into BulkProductType
(bulkProductTypeName)
Values
(@bulkProductTypeName)
go
--update
Create PROCEDURE [dbo].[BulkProductType_Update]
@bulkProductTypeID int,
@bulkProductTypeName nvarchar(50)
as
Update BulkProductType Set
 bulkProductTypeName= @bulkProductTypeName 
 Where bulkProductTypeID= @bulkProductTypeID
go
--delete
Create PROCEDURE [dbo].[BulkProductType_Delete]
@bulkProductTypeID int
AS
Delete FROM BulkProductType 
where bulkProductTypeID = @bulkProductTypeID 
go
--select all
Create PROCEDURE [dbo].[BulkProductType_SelectAll]
AS
Select * from BulkProductType 
go
--select by ID
Create PROCEDURE [dbo].[BulkProductType_SelectByID]
@bulkProductTypeID int
AS
Select * from BulkProductType 
where bulkProductTypeID = @bulkProductTypeID 
go

--DairyProduct
--insert
Create PROCEDURE [dbo].[DairyProduct_Insert]
@dairyProductID int,
@quanlity float,
@unit nvarchar(50),
@refinedDate datetime,
@description nvarchar(100),
@milkTreatmentID int,
@productID int,
@DairyProductTypeID int
as
insert into DairyProduct
(quanlity,unit,refinedDate,description,milkTreatmentID,productID,DairyProductTypeID)
Values
(@quanlity,@unit,@refinedDate,@description,@milkTreatmentID,@productID,@DairyProductTypeID)
go
--update
Create PROCEDURE [dbo].[DairyProduct_Update]
@dairyProductID int,
@quanlity float,
@unit nvarchar(50),
@refinedDate datetime,
@description nvarchar(100),
@milkTreatmentID int,
@productID int,
@DairyProductTypeID int
as
Update DairyProduct Set
 quanlity= @quanlity,unit= @unit,refinedDate= @refinedDate,description= @description,milkTreatmentID= @milkTreatmentID,productID= @productID,DairyProductTypeID= @DairyProductTypeID 
 Where dairyProductID= @dairyProductID
go
--delete
Create PROCEDURE [dbo].[DairyProduct_Delete]
@dairyProductID int
AS
Delete FROM DairyProduct 
where dairyProductID = @dairyProductID 
go
--select all
Create PROCEDURE [dbo].[DairyProduct_SelectAll]
AS
Select * from DairyProduct 
go
--select by ID
Create PROCEDURE [dbo].[DairyProduct_SelectByID]
@dairyProductID int
AS
Select * from DairyProduct 
where dairyProductID = @dairyProductID 
go

--DairyProductType
--insert
Create PROCEDURE [dbo].[DairyProductType_Insert]
@DairyProductTypeID int,
@DairyProductTypeName nvarchar(50)
as
insert into DairyProductType
(DairyProductTypeName)
Values
(@DairyProductTypeName)
go
--update
Create PROCEDURE [dbo].[DairyProductType_Update]
@DairyProductTypeID int,
@DairyProductTypeName nvarchar(50)
as
Update DairyProductType Set
 DairyProductTypeName= @DairyProductTypeName 
 Where DairyProductTypeID= @DairyProductTypeID
go
--delete
Create PROCEDURE [dbo].[DairyProductType_Delete]
@DairyProductTypeID int
AS
Delete FROM DairyProductType 
where DairyProductTypeID = @DairyProductTypeID 
go
--select all
Create PROCEDURE [dbo].[DairyProductType_SelectAll]
AS
Select * from DairyProductType 
go
--select by ID
Create PROCEDURE [dbo].[DairyProductType_SelectByID]
@DairyProductTypeID int
AS
Select * from DairyProductType 
where DairyProductTypeID = @DairyProductTypeID 
go

--Farm
--insert
Create PROCEDURE [dbo].[Farm_Insert]
@farmID int,
@userName nvarchar(50),
@password nvarchar(50),
@name nvarchar(50),
@location nvarchar(50),
@area float,
@famerID int,
@MAFFid nchar(20)
as
insert into Farm
(userName,password,name,location,area,famerID,MAFFid)
Values
(@userName,@password,@name,@location,@area,@famerID,@MAFFid)
go
--update
Create PROCEDURE [dbo].[Farm_Update]
@farmID int,
@userName nvarchar(50),
@password nvarchar(50),
@name nvarchar(50),
@location nvarchar(50),
@area float,
@famerID int,
@MAFFid nchar(20)
as
Update Farm Set
 userName= @userName,password= @password,name= @name,location= @location,area= @area,famerID= @famerID,MAFFid= @MAFFid 
 Where farmID= @farmID
go
--delete
Create PROCEDURE [dbo].[Farm_Delete]
@farmID int
AS
Delete FROM Farm 
where farmID = @farmID 
go
--select all
Create PROCEDURE [dbo].[Farm_SelectAll]
AS
Select * from Farm 
go
--select by ID
Create PROCEDURE [dbo].[Farm_SelectByID]
@farmID int
AS
Select * from Farm 
where farmID = @farmID 
go

--Farmer
--insert
Create PROCEDURE [dbo].[Farmer_Insert]
@farmerID int,
@firstName nvarchar(50),
@lastName nvarchar(50),
@address nvarchar(50),
@phone nvarchar(50),
@email nvarchar(50),
@MAFFid nchar(20)
as
insert into Farmer
(firstName,lastName,address,phone,email,MAFFid)
Values
(@firstName,@lastName,@address,@phone,@email,@MAFFid)
go
--update
Create PROCEDURE [dbo].[Farmer_Update]
@farmerID int,
@firstName nvarchar(50),
@lastName nvarchar(50),
@address nvarchar(50),
@phone nvarchar(50),
@email nvarchar(50),
@MAFFid nchar(20)
as
Update Farmer Set
firstName= @firstName,lastName= @lastName,address= @address,phone= @phone,email= @email,MAFFid= @MAFFid 
 Where farmerID= @farmerID
go
--delete
Create PROCEDURE [dbo].[Farmer_Delete]
@farmerID int
AS
Delete FROM Farmer 
where farmerID = @farmerID 
go
--select all
Create PROCEDURE [dbo].[Farmer_SelectAll]
AS
Select * from Farmer 
go
--select by ID
Create PROCEDURE [dbo].[Farmer_SelectByID]
@farmerID int
AS
Select * from Farmer 
where farmerID = @farmerID 
go

--Field
--insert
Create PROCEDURE [dbo].[Field_Insert]
@fieldID int,
@name nvarchar(50),
@location nvarchar(50),
@area float,
@farmID int,
@fieldType int
as
insert into Field
(name,location,area,farmID,fieldType)
Values
(@name,@location,@area,@farmID,@fieldType)
go
--update
Create PROCEDURE [dbo].[Field_Update]
@fieldID int,
@name nvarchar(50),
@location nvarchar(50),
@area float,
@farmID int,
@fieldType int
as
Update Field Set
 [name]= @name,location= @location,area= @area,farmID= @farmID,fieldType= @fieldType 
 Where fieldID= @fieldID
go
--delete
Create PROCEDURE [dbo].[Field_Delete]
@fieldID int
AS
Delete FROM Field 
where fieldID = @fieldID 
go
--select all
Create PROCEDURE [dbo].[Field_SelectAll]
AS
Select * from Field 
go
--select by ID
Create PROCEDURE [dbo].[Field_SelectByID]
@fieldID int
AS
Select * from Field 
where fieldID = @fieldID 
go

--FieldType
--insert
Create PROCEDURE [dbo].[FieldType_Insert]
@fieldTypeID int,
@typeName nvarchar(50)
as
insert into FieldType
(typeName)
Values
(@typeName)
go
--update
Create PROCEDURE [dbo].[FieldType_Update]
@fieldTypeID int,
@typeName nvarchar(50)
as
Update FieldType Set
 typeName= @typeName 
 Where fieldTypeID= @fieldTypeID
go
--delete
Create PROCEDURE [dbo].[FieldType_Delete]
@fieldTypeID int
AS
Delete FROM FieldType 
where fieldTypeID = @fieldTypeID 
go
--select all
Create PROCEDURE [dbo].[FieldType_SelectAll]
AS
Select * from FieldType 
go
--select by ID
Create PROCEDURE [dbo].[FieldType_SelectByID]
@fieldTypeID int
AS
Select * from FieldType 
where fieldTypeID = @fieldTypeID 
go

--Herd
--insert
Create PROCEDURE [dbo].[Herd_Insert]
@herdID int,
@name nvarchar(50),
@timePastured datetime,
@timeGetOut datetime,
@timeWatered datetime,
@fieldID int
as
insert into Herd
(name,timePastured,timeGetOut,timeWatered,fieldID)
Values
(@name,@timePastured,@timeGetOut,@timeWatered,@fieldID)
go
--update
Create PROCEDURE [dbo].[Herd_Update]
@herdID int,
@name nvarchar(50),
@timePastured datetime,
@timeGetOut datetime,
@timeWatered datetime,
@fieldID int
as
Update Herd Set
 [name]= @name,timePastured= @timePastured,timeGetOut= @timeGetOut,timeWatered= @timeWatered,fieldID= @fieldID 
 Where herdID= @herdID
go
--delete
Create PROCEDURE [dbo].[Herd_Delete]
@herdID int
AS
Delete FROM Herd 
where herdID = @herdID 
go
--select all
Create PROCEDURE [dbo].[Herd_SelectAll]
AS
Select * from Herd 
go
--select by ID
Create PROCEDURE [dbo].[Herd_SelectByID]
@herdID int
AS
Select * from Herd 
where herdID = @herdID 
go

--Livestock
--insert
Create PROCEDURE [dbo].[Livestock_Insert]
@livestockID int,
@LivestockTypeID int,
@name nvarchar(50),
@age int,
@weight float,
@description nvarchar(100),
@MAFFid nchar(20),
@type nvarchar(50),
@quarantined bit,
@herdID int,
@productID int,
@originID int
as
insert into Livestock
(LivestockTypeID,name,age,weight,description,MAFFid,type,quarantined,herdID,productID,originID)
Values
(@LivestockTypeID,@name,@age,@weight,@description,@MAFFid,@type,@quarantined,@herdID,@productID,@originID)
go
--update
Create PROCEDURE [dbo].[Livestock_Update]
@livestockID int,
@LivestockTypeID int,
@name nvarchar(50),
@age int,
@weight float,
@description nvarchar(100),
@MAFFid nchar(20),
@type nvarchar(50),
@quarantined bit,
@herdID int,
@productID int,
@originID int
as
Update Livestock Set
 LivestockTypeID= @LivestockTypeID,name= @name,age= @age,weight= @weight,description= @description,MAFFid= @MAFFid,type= @type,quarantined= @quarantined,herdID= @herdID,productID= @productID,originID= @originID 
 Where livestockID= @livestockID
go
--delete
Create PROCEDURE [dbo].[Livestock_Delete]
@livestockID int
AS
Delete FROM Livestock 
where livestockID = @livestockID 
go
--select all
Create PROCEDURE [dbo].[Livestock_SelectAll]
AS
Select * from Livestock 
go
--select by ID
Create PROCEDURE [dbo].[Livestock_SelectByID]
@livestockID int
AS
Select * from Livestock 
where livestockID = @livestockID 
go

--LivestockHealth
--insert
Create PROCEDURE [dbo].[LivestockHealth_Insert]
@healthID int,
@date datetime,
@typeOfIllness nvarchar(50),
@treatment nvarchar(50),
@dateQuarantined datetime,
@timePenned datetime,
@timePastured datetime,
@livestockID int
as
insert into LivestockHealth
(date,typeOfIllness,treatment,dateQuarantined,timePenned,timePastured,livestockID)
Values
(@date,@typeOfIllness,@treatment,@dateQuarantined,@timePenned,@timePastured,@livestockID)
go
--update
Create PROCEDURE [dbo].[LivestockHealth_Update]
@healthID int,
@date datetime,
@typeOfIllness nvarchar(50),
@treatment nvarchar(50),
@dateQuarantined datetime,
@timePenned datetime,
@timePastured datetime,
@livestockID int
as
Update LivestockHealth Set
 date= @date,typeOfIllness= @typeOfIllness,treatment= @treatment,dateQuarantined= @dateQuarantined,timePenned= @timePenned,timePastured= @timePastured,livestockID= @livestockID 
 Where healthID= @healthID
go
--delete
Create PROCEDURE [dbo].[LivestockHealth_Delete]
@healthID int
AS
Delete FROM LivestockHealth 
where healthID = @healthID 
go
--select all
Create PROCEDURE [dbo].[LivestockHealth_SelectAll]
AS
Select * from LivestockHealth 
go
--select by ID
Create PROCEDURE [dbo].[LivestockHealth_SelectByID]
@healthID int
AS
Select * from LivestockHealth 
where healthID = @healthID 
go

--LivestockType
--insert
Create PROCEDURE [dbo].[LivestockType_Insert]
@LivestockTypeID int,
@LivestockTypeName nvarchar(50)
as
insert into LivestockType
(LivestockTypeName)
Values
(@LivestockTypeName)
go
--update
Create PROCEDURE [dbo].[LivestockType_Update]
@LivestockTypeID int,
@LivestockTypeName nvarchar(50)
as
Update LivestockType Set
 LivestockTypeName= @LivestockTypeName 
 Where LivestockTypeID= @LivestockTypeID
go
--delete
Create PROCEDURE [dbo].[LivestockType_Delete]
@LivestockTypeID int
AS
Delete FROM LivestockType 
where LivestockTypeID = @LivestockTypeID 
go
--select all
Create PROCEDURE [dbo].[LivestockType_SelectAll]
AS
Select * from LivestockType 
go
--select by ID
Create PROCEDURE [dbo].[LivestockType_SelectByID]
@LivestockTypeID int
AS
Select * from LivestockType 
where LivestockTypeID = @LivestockTypeID 
go

--MilkingMix
--insert
Create PROCEDURE [dbo].[MilkingMix_Insert]
@MilkingMixID int,
@time datetime,
@description nvarchar(100),
@quanlity float,
@unit nvarchar(50),
@livestockID int,
@buildingID int
as
insert into MilkingMix
(time,description,quanlity,unit,livestockID,buildingID)
Values
(@time,@description,@quanlity,@unit,@livestockID,@buildingID)
go
--update
Create PROCEDURE [dbo].[MilkingMix_Update]
@MilkingMixID int,
@time datetime,
@description nvarchar(100),
@quanlity float,
@unit nvarchar(50),
@livestockID int,
@buildingID int
as
Update MilkingMix Set
 time= @time,description= @description,quanlity= @quanlity,unit= @unit,livestockID= @livestockID,buildingID= @buildingID 
 Where MilkingMixID= @MilkingMixID
go
--delete
Create PROCEDURE [dbo].[MilkingMix_Delete]
@MilkingMixID int
AS
Delete FROM MilkingMix 
where MilkingMixID = @MilkingMixID 
go
--select all
Create PROCEDURE [dbo].[MilkingMix_SelectAll]
AS
Select * from MilkingMix 
go
--select by ID
Create PROCEDURE [dbo].[MilkingMix_SelectByID]
@MilkingMixID int
AS
Select * from MilkingMix 
where MilkingMixID = @MilkingMixID 
go

--MilkTreatment
--insert
Create PROCEDURE [dbo].[MilkTreatment_Insert]
@milkTreatmentID int,
@date datetime,
@method nvarchar(50),
@location nvarchar(50),
@description nvarchar(100),
@MilkingMixID int
as
insert into MilkTreatment
(date,method,location,description,MilkingMixID)
Values
(@date,@method,@location,@description,@MilkingMixID)
go
--update
Create PROCEDURE [dbo].[MilkTreatment_Update]
@milkTreatmentID int,
@date datetime,
@method nvarchar(50),
@location nvarchar(50),
@description nvarchar(100),
@MilkingMixID int
as
Update MilkTreatment Set
 date= @date,method= @method,location= @location,description= @description,MilkingMixID= @MilkingMixID 
 Where milkTreatmentID= @milkTreatmentID
go
--delete
Create PROCEDURE [dbo].[MilkTreatment_Delete]
@milkTreatmentID int
AS
Delete FROM MilkTreatment 
where milkTreatmentID = @milkTreatmentID 
go
--select all
Create PROCEDURE [dbo].[MilkTreatment_SelectAll]
AS
Select * from MilkTreatment 
go
--select by ID
Create PROCEDURE [dbo].[MilkTreatment_SelectByID]
@milkTreatmentID int
AS
Select * from MilkTreatment 
where milkTreatmentID = @milkTreatmentID 
go

--Origin
--insert
Create PROCEDURE [dbo].[Origin_Insert]
@originID int,
@originType nvarchar(50),
@description nvarchar(100)
as
insert into Origin
(originType,description)
Values
(@originType,@description)
go
--update
Create PROCEDURE [dbo].[Origin_Update]
@originID int,
@originType nvarchar(50),
@description nvarchar(100)
as
Update Origin Set
 originType= @originType,description= @description 
 Where originID= @originID
go
--delete
Create PROCEDURE [dbo].[Origin_Delete]
@originID int
AS
Delete FROM Origin 
where originID = @originID 
go
--select all
Create PROCEDURE [dbo].[Origin_SelectAll]
AS
Select * from Origin 
go
--select by ID
Create PROCEDURE [dbo].[Origin_SelectByID]
@originID int
AS
Select * from Origin 
where originID = @originID 
go

--PreviousOwner
--insert
Create PROCEDURE [dbo].[PreviousOwner_Insert]
@ownerID int,
@name nvarchar(50),
@address nvarchar(50),
@dateOwner datetime,
@dateSell datetime,
@livestockID int
as
insert into PreviousOwner
(name,address,dateOwner,dateSell,livestockID)
Values
(@name,@address,@dateOwner,@dateSell,@livestockID)
go
--update
Create PROCEDURE [dbo].[PreviousOwner_Update]
@ownerID int,
@name nvarchar(50),
@address nvarchar(50),
@dateOwner datetime,
@dateSell datetime,
@livestockID int
as
Update PreviousOwner Set
 name= @name,address= @address,dateOwner= @dateOwner,dateSell= @dateSell,livestockID= @livestockID 
 Where ownerID= @ownerID
go
--delete
Create PROCEDURE [dbo].[PreviousOwner_Delete]
@ownerID int
AS
Delete FROM PreviousOwner 
where ownerID = @ownerID 
go
--select all
Create PROCEDURE [dbo].[PreviousOwner_SelectAll]
AS
Select * from PreviousOwner 
go
--select by ID
Create PROCEDURE [dbo].[PreviousOwner_SelectByID]
@ownerID int
AS
Select * from PreviousOwner 
where ownerID = @ownerID 
go


--Product
--insert
Create PROCEDURE [dbo].[Product_Insert]
@productID int,
@name nvarchar(50),
@type nvarchar(50),
@amount int,
@unit nvarchar(50),
@farmID int
as
insert into Product
(name,type,amount,unit,farmID)
Values
(@name,@type,@amount,@unit,@farmID)
go
--update
Create PROCEDURE [dbo].[Product_Update]
@productID int,
@name nvarchar(50),
@type nvarchar(50),
@amount int,
@unit nvarchar(50),
@farmID int
as
Update Product Set
 name= @name,type= @type,amount= @amount,unit= @unit,farmID= @farmID 
 Where productID= @productID
go
--delete
Create PROCEDURE [dbo].[Product_Delete]
@productID int
AS
Delete FROM Product 
where productID = @productID 
go
--select all
Create PROCEDURE [dbo].[Product_SelectAll]
AS
Select * from Product 
go
--select by ID
Create PROCEDURE [dbo].[Product_SelectByID]
@productID int
AS
Select * from Product 
where productID = @productID 
go

--Quanrantined
--insert
Create PROCEDURE [dbo].[Quanrantined_Insert]
@quarantinedID int,
@note nvarchar(100),
@dateQuarantine datetime,
@dateRejoin datetime,
@livestockID int,
@treatmentID int
as
insert into Quanrantined
(note,dateQuarantine,dateRejoin,livestockID,treatmentID)
Values
(@note,@dateQuarantine,@dateRejoin,@livestockID,@treatmentID)
go
--update
Create PROCEDURE [dbo].[Quanrantined_Update]
@quarantinedID int,
@note nvarchar(100),
@dateQuarantine datetime,
@dateRejoin datetime,
@livestockID int,
@treatmentID int
as
Update Quanrantined Set
 note= @note,dateQuarantine= @dateQuarantine,dateRejoin= @dateRejoin,livestockID= @livestockID,treatmentID= @treatmentID 
 Where quarantinedID= @quarantinedID
go
--delete
Create PROCEDURE [dbo].[Quanrantined_Delete]
@quarantinedID int
AS
Delete FROM Quanrantined 
where quarantinedID = @quarantinedID 
go
--select all
Create PROCEDURE [dbo].[Quanrantined_SelectAll]
AS
Select * from Quanrantined 
go
--select by ID
Create PROCEDURE [dbo].[Quanrantined_SelectByID]
@quarantinedID int
AS
Select * from Quanrantined 
where quarantinedID = @quarantinedID 
go

--Treatment
--insert
Create PROCEDURE [dbo].[Treatment_Insert]
@treatmentID int,
@title nvarchar(50),
@timeTakeDrug datetime,
@timeEat datetime,
@timeWatered datetime,
@isRejoin bit,
@medicationMethod nvarchar(100),
@vetID int
as
insert into Treatment
(title,timeTakeDrug,timeEat,timeWatered,isRejoin,medicationMethod,vetID)
Values
(@title,@timeTakeDrug,@timeEat,@timeWatered,@isRejoin,@medicationMethod,@vetID)
go
--update
Create PROCEDURE [dbo].[Treatment_Update]
@treatmentID int,
@title nvarchar(50),
@timeTakeDrug datetime,
@timeEat datetime,
@timeWatered datetime,
@isRejoin bit,
@medicationMethod nvarchar(100),
@vetID int
as
Update Treatment Set
 title= @title,timeTakeDrug= @timeTakeDrug,timeEat= @timeEat,timeWatered= @timeWatered,isRejoin= @isRejoin,medicationMethod= @medicationMethod,vetID= @vetID 
 Where treatmentID= @treatmentID
go
--delete
Create PROCEDURE [dbo].[Treatment_Delete]
@treatmentID int
AS
Delete FROM Treatment 
where treatmentID = @treatmentID 
go
--select all
Create PROCEDURE [dbo].[Treatment_SelectAll]
AS
Select * from Treatment 
go
--select by ID
Create PROCEDURE [dbo].[Treatment_SelectByID]
@treatmentID int
AS
Select * from Treatment 
where treatmentID = @treatmentID 
go

--Vet
--insert
Create PROCEDURE [dbo].[Vet_Insert]
@vetID int,
@userName nvarchar(50),
@password nvarchar(50),
@name nvarchar(50),
@address nvarchar(50),
@birthDate datetime,
@phoneNumber varchar(15)
as
insert into Vet
(userName,password,name,address,birthDate,phoneNumber)
Values
(@userName,@password,@name,@address,@birthDate,@phoneNumber)
go
--update
Create PROCEDURE [dbo].[Vet_Update]
@vetID int,
@userName nvarchar(50),
@password nvarchar(50),
@name nvarchar(50),
@address nvarchar(50),
@birthDate datetime,
@phoneNumber varchar(15)
as
Update Vet Set
 userName= @userName,password= @password,name= @name,address= @address,birthDate= @birthDate,phoneNumber= @phoneNumber 
 Where vetID= @vetID
go
--delete
Create PROCEDURE [dbo].[Vet_Delete]
@vetID int
AS
Delete FROm Vet 
where vetID = @vetID 
go
--select all
Create PROCEDURE [dbo].[Vet_SelectAll]
AS
Select * from Vet 
go
--select by ID
Create PROCEDURE [dbo].[Vet_SelectByID]
@vetID int
AS
Select * from Vet 
where vetID = @vetID 
go